﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WQMS.Services;

namespace WQMS.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IWebHostEnvironment _env;
        public TestController(IWebHostEnvironment env)
        {
            _env = env;
        }
        [HttpPost]
        public string SayHi() 
        {
            return "Hello World";
        }

        [HttpPost]
        public void CreateEntity() 
        {
            TestServices test = new TestServices();
            var rootRath = _env.ContentRootPath;
            var path = $"{rootRath}/WQMS.Model/Entity";
            test.CreateClassFileByDBTalbe(path);
        }
    }
}
